<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script src="lib/http.js"></script>
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
    <div class="container">
        
    </div>

    <script>
                    var listUrl = "http://192.168.4.18:8000/book"
                    ajax({url:listUrl,method:"get",success:res=>{
                        // console.log(res)
                        // var arr = res.result.albums
                        // console.log(arr.slice(0,20))
                        /* var s =arr.slice(0,20)
                        console.log(s) */
                        res.forEach((item,index)=>{
                            

                            
                            var {coverImage,title,rating,evaluate,labels,price} = item;
                                var sum = labels.join("/")
                            var htmlItem = `
                            <div class="item">
                                
                                <img src ="${coverImage}" alt="">
                                <div class="left-txt">
                                    <p class="title">${title}</p>
                                    
                                    <p><span class="raiting">评分:${rating}</span>
                                        <span class="evaluate">（${evaluate}人评价）    </span>
                                    </p>
                                    <p>
                                        <span class="sum">${sum}</span>
                                        <span class="price">/${price}</span>
                                    </p>
                                    
                                    
                                </div>

                            </div> 
                            `
                            $(".container").append(htmlItem) 
                    })
                        
                    }})
                </script>
</body>
</html>